package com.youfan.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class SystemConfigurer implements WebMvcConfigurer {

    @Value("${picturepath}")
    private String picturepath;


    /**
     * 静态资源的配置 - 使得可以从磁盘中读取 Html、图片、视频、音频等
     */
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry
) {

    registry.addResourceHandler("/static/**")
            .addResourceLocations("file:" + picturepath + "//");

  }

}

